#ifndef SYSTEMWIDGET_H
#define SYSTEMWIDGET_H

#include <QWidget>
#include <QGroupBox>
#include <QComboBox>
#include <QSpinBox>
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QScrollArea>
#include <QFontDatabase>
#include "ConfigService.h"

class SystemWidget : public QWidget
{
    Q_OBJECT
public:
    explicit SystemWidget(QWidget *parent = nullptr);
    ~SystemWidget();
signals:
    void sigClose();
    void sigFontChanged();
    void sigLanguageChanged();
private slots:
    void onSaveDataBtn();
    void onFontFamilyChanged(const QString &family);
    void onFontSizeChanged(int size);
    void onFontBoldChanged(int state);
    void onFontItalicChanged(int state);
    void onFontUnderlineChanged(int state);
    void onLanguageChanged(const QString &language);
    void onResetToDefault();
private:
    void setupForm();
    void initData();
    void saveData();
    void loadSystemInfo();
    void setupFontSettings();
    void setupLanguageSettings();
    void setupSystemInfo();
    void setupWindowSettings();
    void applyStyles();
    
    // 字体设置
    QGroupBox *fontGroup;
    QComboBox *fontFamilyCombo;
    QSpinBox *fontSizeSpin;
    QCheckBox *fontBoldCheck;
    QCheckBox *fontItalicCheck;
    QCheckBox *fontUnderlineCheck;
    QLabel *fontPreviewLabel;
    
    // 语言设置
    QGroupBox *languageGroup;
    QComboBox *languageCombo;
    
    // 系统信息
    QGroupBox *systemInfoGroup;
    QLabel *osLabel;
    QLabel *osValueLabel;
    QLabel *qtLabel;
    QLabel *qtValueLabel;
    QLabel *cpuLabel;
    QLabel *cpuValueLabel;
    QLabel *memoryLabel;
    QLabel *memoryValueLabel;
    
    // 窗口设置
    QGroupBox *windowGroup;
    QCheckBox *alwaysOnTopCheck;
    QCheckBox *startMinimizedCheck;
    
    // 按钮
    QPushButton *btnApply;
    QPushButton *btnReset;
    QPushButton *btnClose;
    
    QFont m_font;
    QString m_currentLanguage;
};

#endif // SYSTEMWIDGET_H
